Repository navigation
ref: route all SDK diagnostics through debugLogger - #2631
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Notice warnings and errors print at warn when no debug log level is configured, respect an explicit level, and are silenced by debugLogLevel: false. Use it for diagnostics that were always shown before routing through debugLogger, only mark the span customizer failure as logged once it is emitted, and drop duplicate Braintrust prefixes from logger messages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2aed613 to
40d8ea4
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 40d8ea4827
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "Codex (@codex) review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".
| iso.getEnv("BRAINTRUST_DEBUG_LOG_LEVEL") ?? | ||
| // Loader and bundler diagnostics can run before platform initialization. | ||
| (typeof process !== "undefined" | ||
| ? process.env.BRAINTRUST_DEBUG_LOG_LEVEL |
There was a problem hiding this comment.
Guard the process.env fallback
In browser or edge runtimes that expose a partial process shim without process.env, this fallback throws while evaluating process.env.BRAINTRUST_DEBUG_LOG_LEVEL. browser/config.ts explicitly supports this environment by having iso.getEnv return undefined when process.env is absent, but the new fallback defeats that guard; because browser initialization constructs BraintrustState, which calls getEnvDebugLogLevel, importing the SDK can now fail before use. Check that process.env exists before dereferencing it.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 6815ef2: the fallback now checks typeof process.env !== "undefined" (matching browser/config.ts), with a test for a process shim without env.
|
cool! |
Browser and edge runtimes can expose a process shim without env. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Was looking at adding console.log instrumentation and figured we need to do this first. But open to other ideas.
AI Summary
Routes the SDK's remaining
console.*diagnostics throughdebugLogger. AddsdebugLogger.noticefor user-facing messages that should stay visible by default.notice.*configureInstrumentation, span customizer failure, dev server errors,publish()warnings, scorer/vitest warnings, auto-instrumentation transform failureswarn/error/debugBehavior changes
BRAINTRUST_DEBUG_LOG_LEVEL/debugLogLevelDEBUG='@braintrust*'showed auto-instrumentation statusBRAINTRUST_DEBUG_LOG_LEVEL=debug[braintrust] [Braintrust] ...🤖 Generated with Claude Code